package com.gewu.pm.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.gewu.pm.R;
import com.gewu.pm.app.AppAdapter;

/**
 * 抄送人适配器
 */
public final class CcPersonAdapter extends AppAdapter<String> {

    public CcPersonAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<String>.ViewHolder {

        private final ImageView ivAvatar;
        private final TextView tvName;

        private ViewHolder() {
            super(R.layout.cc_person_item);
            ivAvatar = findViewById(R.id.iv_avatar);
            tvName = findViewById(R.id.tv_name);
        }

        @Override
        public void onBindView(int position) {
            String name = getItem(position);
            tvName.setText(name);
            // TODO: 加载头像
            // GlideApp.with(getContext()).load(avatarUrl).into(ivAvatar);
        }
    }
}
